In this script, there is conducted the estimation for the measure_marginal approach for a single given env.

The env = ethereumjs, the programs file =pg_marginal_full5_c50_step5_shuffle.csv, the resutls file = results_ethereumjs_marginal_full5_c50_step5.csv.

Switch removed_outliers to FALSE to see the comparison.

if (!removed_outliers) {
  boxplot(measurements[which(measurements$env == env), 'measure_total_time_ns'] ~ measurements[which(measurements$env == env), 'opcode'], las=2, outline=TRUE, log='y', main=paste(env, 'all'))
}
if (removed_outliers) {
  measurements = remove_compare_outliers(measurements, 'measure_total_time_ns', c(env))
}

Every sample starts with a fresh evm instance. We investigate whether the results may depend on the time from evm start - related to run_id. To avoid being overrun by the number of images, all op_count for a given run_id are are placed, so values are not centered. That should not be an issue.

Now we can investigate the linear regressions.

for (opcode in all_opcodes) {
  estimate = compute_all(opcode=opcode, env=env, use_median=TRUE, plots=ifelse(details,'all','scatter'))
  estimates[nrow(estimates) + 1, ] = c(opcode, estimate, env)
}

estimates
##                 op estimate_marginal_ns estimate_marginal_ns_stderr        env
## 1              ADD            152.53100                   24.340354 ethereumjs
## 2              MUL            155.75361                   21.930407 ethereumjs
## 3              SUB            130.92303                   22.473117 ethereumjs
## 4              DIV            193.61806                   14.236910 ethereumjs
## 5             SDIV            218.08273                   16.429146 ethereumjs
## 6              MOD            191.92173                   17.930697 ethereumjs
## 7             SMOD            219.47246                   16.037787 ethereumjs
## 8           ADDMOD            221.54133                   22.595717 ethereumjs
## 9           MULMOD            259.19652                   19.318109 ethereumjs
## 10             EXP            645.91532                   31.096959 ethereumjs
## 11      SIGNEXTEND            306.59391                   20.441805 ethereumjs
## 12              LT            159.87099                   22.006126 ethereumjs
## 13              GT            133.66491                   22.699793 ethereumjs
## 14             SLT            176.46131                   27.295968 ethereumjs
## 15             SGT            201.38620                   22.839786 ethereumjs
## 16              EQ            154.67157                   27.599952 ethereumjs
## 17          ISZERO            149.10647                   16.933221 ethereumjs
## 18             AND            187.25040                   21.586940 ethereumjs
## 19              OR            160.41607                   21.411621 ethereumjs
## 20             XOR            144.55754                   25.371715 ethereumjs
## 21             NOT            176.05545                   30.169038 ethereumjs
## 22            BYTE            209.31895                   22.796598 ethereumjs
## 23             SHL            181.26354                   23.967461 ethereumjs
## 24             SHR            144.82225                   30.587309 ethereumjs
## 25             SAR            219.64613                   24.974213 ethereumjs
## 26         ADDRESS            424.98038                    8.693360 ethereumjs
## 27          ORIGIN            450.63703                    7.259244 ethereumjs
## 28          CALLER            434.64212                    8.628037 ethereumjs
## 29       CALLVALUE            177.85439                    4.498719 ethereumjs
## 30    CALLDATALOAD            198.35441                   25.807451 ethereumjs
## 31    CALLDATASIZE            171.01375                    9.759485 ethereumjs
## 32    CALLDATACOPY            890.32214                   15.728927 ethereumjs
## 33        CODESIZE            146.30922                    8.640974 ethereumjs
## 34        CODECOPY            649.02615                   17.060940 ethereumjs
## 35        GASPRICE            121.27857                    8.035235 ethereumjs
## 36  RETURNDATASIZE            182.69300                    8.255133 ethereumjs
## 37  RETURNDATACOPY            723.26992                   14.835168 ethereumjs
## 38        COINBASE            513.38108                   11.120949 ethereumjs
## 39       TIMESTAMP            170.53105                    3.869257 ethereumjs
## 40          NUMBER            161.43921                    5.154925 ethereumjs
## 41      DIFFICULTY            568.90897                   11.864415 ethereumjs
## 42        GASLIMIT            167.34749                    2.441514 ethereumjs
## 43         CHAINID            150.13811                    6.791814 ethereumjs
## 44     SELFBALANCE            126.21484                    7.160193 ethereumjs
## 45             POP            109.29246                   10.148315 ethereumjs
## 46           MLOAD            769.09396                   17.833143 ethereumjs
## 47          MSTORE           1928.91248                   29.107845 ethereumjs
## 48         MSTORE8            513.78793                   25.247915 ethereumjs
## 49            JUMP            212.84688                   18.741794 ethereumjs
## 50           JUMPI            347.02898                   85.586872 ethereumjs
## 51              PC            140.06425                    4.563915 ethereumjs
## 52           MSIZE            147.44057                    9.860618 ethereumjs
## 53             GAS            133.91896                    7.820372 ethereumjs
## 54        JUMPDEST            141.17508                    3.014037 ethereumjs
## 55           PUSH1            227.75614                    5.452955 ethereumjs
## 56           PUSH2            230.64537                    8.009722 ethereumjs
## 57           PUSH3            301.16341                    8.785983 ethereumjs
## 58           PUSH4            311.99749                    6.709669 ethereumjs
## 59           PUSH5            324.96048                   11.757448 ethereumjs
## 60           PUSH6            345.62657                    9.584172 ethereumjs
## 61           PUSH7            365.78691                    8.027555 ethereumjs
## 62           PUSH8            361.91451                   14.384746 ethereumjs
## 63           PUSH9            368.38924                    7.348847 ethereumjs
## 64          PUSH10            388.71547                    8.057593 ethereumjs
## 65          PUSH11            402.10820                   10.111263 ethereumjs
## 66          PUSH12            415.76806                    9.848667 ethereumjs
## 67          PUSH13            419.25758                    9.052434 ethereumjs
## 68          PUSH14            445.91865                    8.872741 ethereumjs
## 69          PUSH15            441.84577                   10.680187 ethereumjs
## 70          PUSH16            470.13033                    8.482324 ethereumjs
## 71          PUSH17            459.16464                    6.532249 ethereumjs
## 72          PUSH18            472.58033                    8.490684 ethereumjs
## 73          PUSH19            483.75190                    6.711854 ethereumjs
## 74          PUSH20            490.84098                    9.741501 ethereumjs
## 75          PUSH21            515.50474                    8.427140 ethereumjs
## 76          PUSH22            509.97664                    9.138016 ethereumjs
## 77          PUSH23            521.04467                   10.051578 ethereumjs
## 78          PUSH24            555.28091                    6.981413 ethereumjs
## 79          PUSH25            555.64281                    8.403777 ethereumjs
## 80          PUSH26            570.22667                   11.715151 ethereumjs
## 81          PUSH27            590.04318                    4.598607 ethereumjs
## 82          PUSH28            599.05064                   13.042528 ethereumjs
## 83          PUSH29            614.31861                    5.587013 ethereumjs
## 84          PUSH30            622.95495                    9.110753 ethereumjs
## 85          PUSH31            634.52892                    9.904505 ethereumjs
## 86          PUSH32            648.32570                    5.427654 ethereumjs
## 87            DUP1            127.37960                   26.854977 ethereumjs
## 88            DUP2            133.41588                   29.292115 ethereumjs
## 89            DUP3             97.07227                   24.372410 ethereumjs
## 90            DUP4             93.72913                   30.041670 ethereumjs
## 91            DUP5            106.54116                   27.919318 ethereumjs
## 92            DUP6            129.51432                   30.691289 ethereumjs
## 93            DUP7             83.31561                   15.309762 ethereumjs
## 94            DUP8            116.32646                   22.033678 ethereumjs
## 95            DUP9            101.78606                   28.472552 ethereumjs
## 96           DUP10            113.24527                   21.921460 ethereumjs
## 97           DUP11            134.08170                   48.401150 ethereumjs
## 98           DUP12             84.36234                   25.123781 ethereumjs
## 99           DUP13            125.71269                   29.075862 ethereumjs
## 100          DUP14            126.60643                   26.308655 ethereumjs
## 101          DUP15            104.53705                   21.469432 ethereumjs
## 102          DUP16            120.33388                   18.048825 ethereumjs
## 103          SWAP1            139.30212                    9.537951 ethereumjs
## 104          SWAP2            115.92233                   17.083442 ethereumjs
## 105          SWAP3            115.04370                   16.114826 ethereumjs
## 106          SWAP4            103.19543                   15.089949 ethereumjs
## 107          SWAP5            148.00603                   22.827981 ethereumjs
## 108          SWAP6            139.38377                   17.348114 ethereumjs
## 109          SWAP7             94.33530                   18.076904 ethereumjs
## 110          SWAP8            144.87672                    9.010538 ethereumjs
## 111          SWAP9            125.41706                    9.250232 ethereumjs
## 112         SWAP10            110.22036                   20.720147 ethereumjs
## 113         SWAP11            140.58195                    9.201213 ethereumjs
## 114         SWAP12            120.98113                    9.939055 ethereumjs
## 115         SWAP13            128.49941                   14.243755 ethereumjs
## 116         SWAP14            109.51834                   13.414641 ethereumjs
## 117         SWAP15            147.90196                   11.495252 ethereumjs
## 118         SWAP16            124.77129                   17.623051 ethereumjs
## 119          MCOPY           1035.01826                  187.884463 ethereumjs
## 120          PUSH0            128.90316                    6.870669 ethereumjs
## 121           SHA3          14904.19474                   56.604375 ethereumjs
## 122           LOG0            482.35480                   72.117576 ethereumjs
## 123           LOG1           1275.87909                  236.701770 ethereumjs
## 124           LOG2           1487.05427                  345.492258 ethereumjs
## 125           LOG3           1865.79075                  429.797559 ethereumjs
## 126           LOG4           1983.86863                  488.621477 ethereumjs

The results are exported to ./ethereumjs_marginal_estimated_cost.csv.